﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Data.SqlClient;
using System.Linq;
using System.Text;
using QuanLyDatVe.DataAccessLayer;

namespace QLNHang.DAO
{
     public class ThucDonDAO
    {
         private ConnectDatabase cn = new ConnectDatabase();
         public int TaoThucDon()
         {
             cn.OpenDatabase();
             SqlCommand cmd = new SqlCommand("sp_TaoThucDon", cn.SqlConnect);
             cmd.CommandType = CommandType.StoredProcedure;
             int identity = Convert.ToInt32(cmd.ExecuteScalar());
             cn.CloseDatabase();
             return identity;
         }

         public void CapNhatThucDon(int maThucDon, String date)
         {
             cn.OpenDatabase();
             SqlCommand cmd = new SqlCommand("sp_CapNhatNgayDatThucDon", cn.SqlConnect);
             cmd.CommandType = CommandType.StoredProcedure;
             cmd.Parameters.Add("@maThucDon", SqlDbType.Int).Value = maThucDon;
             cmd.Parameters.Add("@ngayApDung", SqlDbType.Date).Value = date;
             cmd.ExecuteNonQuery();
             cn.CloseDatabase();
         }
    }
}
